/**
 * Lockbox
 * a Password and Secret Information Manager
 * Enhancements to UIPreferencesTable
 *
 * Created by Nathan Black
 */

#import "UIPreferencesTableEx.h"

@implementation UIPreferencesTableEx 

// Sadly UIPreferencesTable doesn't call it's data source for canSelectRow. Sigh.
- (BOOL) canSelectRow:(int)row
{
    if (_dataSource != nil && [_dataSource respondsToSelector:@selector(canSelectRow:)]) {
        return [_dataSource canSelectRow:row];
    }
    else {
        return [super canSelectRow:row];    
    }
}

- (void)stopEditing
{
    
    if (_editingCell != NULL && [_editingCell respondsToSelector:@selector(resignFirstResponder)]) {
        [_editingCell resignFirstResponder];
    }
    [self setKeyboardVisible:FALSE animated:TRUE];
    [self _setEditingCell:NULL];
    _selectedRow = -1;
    
    /*int currRow = [_prefsTable selectedRow];
    if (currRow > 0 && currRow <= LBIV_MAXFIELDROWS) {
        [_editField[currRow - 1] resignFirstResponder];
    }
    [_prefsTable setKeyboardVisible:FALSE animated:TRUE];
    [_prefsTable _setEditingCell:NULL];*/

}

@end